<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width,initial-scale=1.0,user-scalable=0,maximum-scale=1.0" />
    <script src="http://g.tbcdn.cn/mtb/lib-flexible/0.3.4/??flexible_css.js,flexible.js"></script>
    <link rel="stylesheet" type="text/css" href="css/reset.css"/>
    <link rel="stylesheet" type="text/css" href="css/style.css"/>
    <script src="https://cdn.bootcss.com/jquery/3.3.1/jquery.min.js" type="text/javascript" charset="utf-8"></script>
    <script src="js/public.js" type="text/javascript" charset="utf-8"></script>
    <title>扫码点餐—订单</title>
		
</head>
<body>
	<div id="order">
		<!--<div class="orderList">
			<div class="List_title">
				<span class="payTime">
						下单日期:<i class="time"></i>
				</span>
				<span class="payState">
						<i class="state"></i>
				</span>
			</div>
			<div class="menu_header">
				<span class="current_num">当前桌号:<span class="znum"></span></span>
				<span class="people_num">
					人数:<span class="pnum"></span>人
				</span>
			</div>
			<div class="payCon">
				<div class="content">
					<span class="consume">消费金额: ¥ <i class="totalPrice"></i>.00</span>
					<span class="payTime">
					</span>
					<span class="discount">优惠金额: ¥ <i class="minus_price"></i></span>
					<span class="payable">已支付: ¥<i class="actualPrice"></i>.00</span>
				</div>
			</div>
			<div class="carCenter">
				<div class="centerList">
					<h2 class="listClassify">
						煲类
						<span class="sum">2 份</span>
					</h2>
					<ul class="listcon">
						<li>
							<img class="listImg" src="images/list_con.png"/>
							<div class="content">
								<span class="listName">肉蟹煲</span>
								<span class="listType">不辣</span>
								<span class="listPrice">￥138.00</span>
							</div>
							<span class="list_num">
								X 1
							</span>
							<div class="list_right">
								<img src="images/completed.png"/>
							</div>
						</li>
						<li>
							<img class="listImg" src="images/list_con.png"/>
							<div class="content">
								<span class="listName">肉蟹煲</span>
								<span class="listType">不辣</span>
								<span class="listPrice">￥138.00</span>
							</div>
							<span class="list_num">
								X 1
							</span>
							<div class="list_right">
								<img src="images/completed.png"/>
							</div>
						</li>
					</ul>
				</div>
			</div>
		</div>-->
		<!--<div class="float_con">
			<div class="continue" onclick="continue()">
				<i class="icon"></i>
				<span class="txt">继续点餐</span>
			</div>
			<div  class="goBackMenu" onclick="goBackMenu()">
				<i class="icon"></i>
				<span class="txt">返回菜单</span>
			</div>
		</div>-->
		
	</div>
<script type="text/javascript">
 $(function () {
        (function ($) {
            $.getUrlParam = function (name) {
                var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)");
                var r = window.location.search.substr(1).match(reg);
                if (r != null) return unescape(r[2]);
                return null;
            }
        })
        (jQuery);
        $(".znum").html($.getUrlParam('znum'));
        $(".pnum").html($.getUrlParam('pnum'));
        znum=$(".znum").html();
        pnum=$(".pnum").html();
    })
//当前下单时间
	function timestampToTime(timestamp) {
        var date = new Date(timestamp * 1000);//时间戳为10位需*1000，时间戳为13位的话不需乘1000
        Y = date.getFullYear() + '-';
        M = (date.getMonth()+1 < 10 ? '0'+(date.getMonth()+1) : date.getMonth()+1) + '-';
        D = date.getDate() + ' ';
        h = date.getHours() + ':';
        m = date.getMinutes() + ':';
        s = date.getSeconds();
        return Y+M+D+h+m+s;
   } 	
   		
   		var customer_id=window.localStorage.getItem('customer_id')
   		console.log(customer_id)
		$.ajax({
            url:url() + "index.php?s=/Api/DishesOrder/orderList",
            data:{'customer_id':customer_id},
            dataType:"json",
            type:"get",
            success:function (data) {
                console.log(data);
                if(data){
                	var html1 = ''
					var count=0;
					var total_price=0;
                	$.each(data.data, function (i, items) {
                		var timestamp=timestampToTime(items.time)
                		html1+='<div class="orderList">';
						html1+='<div class="List_title">';
						html1+='<span class="payTime">下单日期:<i class="time">'+timestamp+'</i></span>';
						html1+='<span class="payState"><i class="state">'+items.fromart_state+'</i></span>';
						html1+='</div>';
						html1+='<div class="menu_header">';
						html1+='<span class="current_num">当前桌号:<span class="znum">'+items.desk_number+'</span></span>';
						html1+='<span class="people_num">人数:<span class="pnum">'+items.people_number+'</span>人</span>';
						html1+='</div>';
						html1+='<div class="payCon">';
						html1+='<div class="content">';
						html1+='<span class="consume">消费金额: ¥ <i class="totalPrice">'+items.total_price+'</i>.00</span>';
						html1+='<span class="payTime"></span>';
						html1+='<span class="discount">优惠金额: ¥ <i class="minus_price"></i></span>';
						html1+='<span class="payable">已支付: ¥<i class="actualPrice"></i>.00</span>';
						html1+='</div>';
						html1+='</div>';
						html1+='<div class="carCenter">';
						
						$.each(items.list, function (i, sitems) {
							html1+='<div class="centerList">';
//							html1+='<h2 class="listClassify">煲类<span class="sum">2 份</span></h2>';
							html1+='<ul class="listcon">';
//							$.each(sitems, function (i, ssitems){
								html1+='<li>';
								html1+='<img class="listImg" src="images/list_con.png"/>';
								html1+='<div class="content">';
								html1+='<span class="listName">'+sitems.name+'</span>';
								html1+='<span class="listType">'+sitems.practice+'</span>';
								html1+='<span class="listPrice">'+'￥'+sitems.price+'</span>';
								html1+='</div>';
								html1+='<span class="list_num">'+'X'+sitems.count+'</span>';
								html1+='<div class="list_right">';
								// html1+='<img src="images/completed.png"/>';
								html1+='</div>';
								html1+='</li>';
//							})
							
							html1+='</ul>';
							html1+='</div>';
							
							})
						html1+='</div>';
						html1+='</div>';
		        })
                	$('#order').html(html1)
                }
            }
        })
</script>
</body>
</html>